const express = require('express')
const router = express.Router()
const multer = require('multer');
const upload = multer({ dest: 'uploads/' }); // 临时目录，用于存储上传的文件

//导入路由处理函数对应的模块
const imgupload_handler = require('../router_handler/imgupload')


// 定义图片上传请求的路由
router.post('/draw', upload.single('image'), imgupload_handler.Draw_ImageUpload);
router.get('/draw', imgupload_handler.Draw_ImagesGetAll);

router.post('/write', upload.single('image'), imgupload_handler.Write_ImageUpload);
router.get('/write', imgupload_handler.Write_ImagesGetAll);

router.post('/code', upload.single('image'), imgupload_handler.Code_ImageUpload);
router.get('/code', imgupload_handler.Code_ImagesGetAll);

router.post('/life', upload.single('image'), imgupload_handler.Life_ImageUpload);
router.get('/life', imgupload_handler.Life_ImagesGetAll);

module.exports = router